<template>
	<view style="padding: 0 20upx;">
		<view style="font-size: 38upx;font-weight: 550;">
			{{res.article_title}}
		</view>
		<view style="line-height: 80upx;height: 80upx;">
			<text style="color: #24B2F4;">{{res.auth}} </text>
			<text style="padding-left: 20upx;color: #999;">发布时间: {{res.article_date}}</text>
		</view>
		<!-- <view style="text-align: center;">
			<video poster="http://bhh.ax1319.com/attachment/images/4/2020/06/I2NAuMM4f34yf9a3uwO4ViI3V923ho.png" class="edui-upload-video video-js vjs-default-skin video-js" controls="true" width="300" height="200" src="https://bhh168.oss-cn-beijing.aliyuncs.com/5c440f94186b1078b93ee46a78742d68.mp4" data-setup="{}">
				<source src="https://bhh168.oss-cn-beijing.aliyuncs.com/5c440f94186b1078b93ee46a78742d68.mp4" type="video/mp4"/>
			</video>
		</view> -->
		<view style="height: 465upx;margin: 0 20upx;" v-if="res.video_url">
			<video
				:src="res.video_url"
				autoplay
				:muted="muted"
				loop
				controls
				style="width: 100%;position: relative;"
			>
			</video>
		</view>
		<view>
			<rich-text :nodes="content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		onShareAppMessage(res) {
			if (res.from === 'button') {// 来自页面内分享按钮
			}
			if (this.pid_father == '' || this.pid_father == undefined || this.pid_father== null){
				uni.navigateTo({
					url: '../login/login'
				})
			}
			return {
				title: this.res.article_title,
				path: '/pageA/essay/essay?pid=' + this.pid_father + '&essaysid=' + this.essaysid
			}
		},
		data() {
			return {
				res:[],
				openid:'',
				essaysid:'',
				content:'',
			};
		},
		onLoad:function(e){
			if ( e.pid ) {
				uni.setStorage({
					key: 'pid',
					data: e.pid
				})
			}
			this.essaysid = e.essaysid
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: 'https://app.t9y9y9.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=article.article_detail&app=1',
					data: { 'id': this.essaysid },
					success: res => {
						this.res = res.data
						this.content = res.data.article_content
					},
					fail: () => {},
					complete: () => {}
				});
				uni.hideLoading()
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff!important;
	}
</style>
